﻿@model SenFangKaoHe_MVC.Models.Entity.kaohe;

@{
    Layout = null;
    ViewData["title"] = Model.MingCheng;
}
<link rel="stylesheet" href="~/css/ShiJuanStyle.css" />
<script src="~/js/jquery-3.7.1.min.js"></script>

<div id="info">
    <div id="info1">
        <div>
            <label style="font-size:35px;font-family:SimHei">@Model.MingCheng</label><br />
            <br />
        </div>
        <div>
            【考核范围】<br />
            <input type="hidden" id="kaohetiku" value="@Model.TiKuid" />
            <div id="tikudiv" style="font-size:25px;font-family:SimHei"></div>
        </div>
        <div>
            <br />
            【考核内容】<br />
            <table>
                <tr>
                    <td>题型</td>
                    <td>试题数量</td>
                    <td>每题分值</td>
                </tr>
                <tr>
                    <td>填空题</td>
                    <td>@Model.TianKong</td>
                    <td>@Model.TianKongFen</td>
                </tr>
                <tr>
                    <td>单选题</td>
                    <td>@Model.DanXuan</td>
                    <td>@Model.DanXuanFen</td>
                </tr>
                <tr>
                    <td>多选题</td>
                    <td>@Model.DuoXuan</td>
                    <td>@Model.DuoXuanFen</td>
                </tr>
                <tr>
                    <td>判断题</td>
                    <td>@Model.PanDuan</td>
                    <td>@Model.PanDuanFen</td>
                </tr>
            </table>
        </div>

        <div>
            <input type="hidden" id="khid" value="@Model.Id" />
            <input type="hidden" id="xm" class="mo-input" style="text-align:center" placeholder="请输入姓名" />
        </div>
        <br />
        <div style="text-align:center">
        <input type="button" value="开始考试" onclick="start()" />
        </div>
    </div>
</div>
<script>
function getQueryParam(param) {
    const urlParams = new URLSearchParams(window.location.search);
    return urlParams.get(param);
}
</script>
<script>
    $(document).ready(function(){
        $("#xm").val(getQueryParam('xm'));
        var khtkid = $("#kaohetiku").val();
         $.ajax({
                url: "/TiKu/getTiKuMingCheng",    //后台数据请求地址
                type: "get",
                dataType: 'html',
                traditional: true,
                data:{
                    tkids: khtkid    //参数传递
                },
                async: true,
                success: function (resut) {
                    var _ry = "";
                    for(var i = 0;i<resut.split(",").length;i++){
                        _ry += resut.split(",")[i]+"<br />";
                    }
                    console.log(_ry);
                    $("#tikudiv").html(_ry);
                }
                });

    });

    function start(){
        if($("#xm").val() == ""){
            alert("请输入姓名！");
            return;
        }else{

            var url = "/ShiJuan/Create?khid="+$("#khid").val()+"&xm="+$("#xm").val();
            //var url = "/ShiJuan/Create/"+$("#khid").val()+"/"+$("#xm").val();
            console.log(url);
            window.location.href=url;
        }
    }
</script>